package com.canyou.activiti.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.canyou.activiti.entity.DeploymentVO;
import com.canyou.activiti.entity.ProcessDefinitionVO;
import org.activiti.engine.repository.Deployment;

import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author canyou
 * @since 2021-03-02
 */
public interface ProcessDefinitionService {

    /**
     * 分页获取流程部署
     *
     * @param page
     * @param processName 流程部署名称
     * @param processKey  流程部署key
     * @return
     */
    IPage<ProcessDefinitionVO> getPageList(IPage<ProcessDefinitionVO> page, String processName, String processKey);

    /**
     * 删除部署流程
     *
     * @param deploymentId
     */
    void deleteProcessDefinition(String deploymentId);

    /**
     * 激活/挂起部署流程
     *
     * @param processDefinitionId
     * @param suspensionState
     */
    void activeOrSuspendProcessDefinition(String processDefinitionId, Integer suspensionState);

    /**
     * 根据zip或者bpmn文件部署流程
     *
     * @param mediaId
     * @param processDefinitionName
     * @return
     */
    DeploymentVO deployFile(Long mediaId, String processDefinitionName);

    /**
     * 获取流程定义XML
     *
     * @param response
     * @param deploymentId
     * @param resourceName
     */
    void getXml(HttpServletResponse response, String deploymentId, String resourceName);

    /**
     * 通过流程图xml字符串添加流程定义
     *
     * @param bpmnStr 流程图xml字符串
     * @return
     */
    Deployment addDeploymentByString(String bpmnStr);

    /**
     * 初始化流程定义模型
     *
     * @param processDefinitionId 流程定义id
     */
    void initBpmnModel(String processDefinitionId);

}
